package container;

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;

/**
 * Trait of a weapon.
 * 
 * @author Marcus
 */
@XmlRootElement
public class WeaponTrait implements Comparable<WeaponTrait> {

	private String traitName;

	private String traitCode;

	private int rating;

	private boolean ratedTrait;

	/**
	 * @return the traitName
	 */
	@XmlAttribute(name = "Name", required = true)
	public String getTraitName() {
		return this.traitName;
	}

	/**
	 * @param name
	 *            the traitName to set
	 */
	public void setTraitName(String name) {
		this.traitName = name;
	}

	/**
	 * @return the traitCode
	 */
	@XmlAttribute(name = "Code", required = true)
	public String getTraitCode() {
		return this.traitCode;
	}

	/**
	 * @param code
	 *            the traitCode to set
	 */
	public void setTraitCode(String code) {
		this.traitCode = code;
	}

	/**
	 * @return the rating
	 */
	@XmlAttribute(name = "Rating", required = true)
	public int getRating() {
		return this.rating;
	}

	/**
	 * @param setRating
	 *            the rating to set
	 */
	public void setRating(int setRating) {
		this.rating = setRating;
	}

	/**
	 * @return the ratedTrait
	 */
	@XmlAttribute(name = "Rated", required = true)
	public boolean isRatedTrait() {
		return this.ratedTrait;
	}

	/**
	 * @param setRatedTrait
	 *            the ratedTrait to set
	 */
	public void setRatedTrait(boolean setRatedTrait) {
		this.ratedTrait = setRatedTrait;
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public int compareTo(WeaponTrait o) {
		return getTraitCode().compareTo(o.getTraitCode());
	}
}
